// window \
//linux /
let path = require('path');
console.log(path.sep);
//path.posix旨的linux环境 /


console.log(path.posix.sep);// /
console.log(path.win32.sep);// \
require('path').sep
'/'

function toUnixPath(filePath) {
    return filePath.replace(/\\/g, "/");
  }
let baseDir = toUnixPath(process.cwd());


console.log('baseDir',baseDir);  // /Users/adminx/Desktop/Ikki-study/webpack-advanced/webpack5-base
let depModulePath = toUnixPath(__filename);
console.log('depModulePath',depModulePath); // /Users/adminx/Desktop/Ikki-study/webpack-advanced/webpack5-base/4.flow/doc/2.posix.js
console.log("./"+path.posix.relative(baseDir,depModulePath)); // ./4.flow/doc/2.posix.js